﻿using System;
using System.Data;
using System.Collections.Generic;
using ElingOA6_Admin_DSJCJ.Model;
namespace ElingOA6_Admin_DSJCJ.BLL
{
    /// <summary>
    /// 重点督查（文件阅办）处理
    /// </summary>
    public partial class TaskDo
    {
        /// <summary>
        /// 重点督查（文件阅办）处理
        /// </summary>
        private readonly ElingOA6_Admin_DSJCJ.DAL.TaskDo dal = new ElingOA6_Admin_DSJCJ.DAL.TaskDo();

        /// <summary>
        /// 重点督查（文件阅办）处理
        /// </summary>
        public TaskDo()
        { }
        #region  BasicMethod
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        /// <param name="FTaskDoID">处理类编号</param>
        /// <param name="FTaskID">重点督查（文件阅办）编号</param>
        /// <returns>是否存在记录</returns>
        public bool Exists(decimal FTaskDoID, decimal FTaskID)
        {
            return dal.Exists(FTaskDoID, FTaskID);
        }

        /// <summary>
        /// 增加一条记录
        /// </summary>
        /// <param name="model">处理结果记录</param>
        /// <param name="taskModel">改变主记录状态</param>
        public void Add(ElingOA6_Admin_DSJCJ.Model.TaskDo model, Model.TaskAttach taskAttachModel, Model.Task taskModel)
        {
             dal.Add(model, taskAttachModel, taskModel);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        /// <param name="model">增加处理记录</param>
        /// <param name="taskAttachModel">附件记录</param>
        /// <param name="taskModel">改变主记录状态</param>
        public void check(ElingOA6_Admin_DSJCJ.Model.TaskDo model, Model.Task taskModel)
        {
            dal.check(model, taskModel);
        }

        /// <summary>
        ///  更新一条数据
        /// </summary>
        /// <param name="model">更新实体类</param>
        /// <returns>是否更新成功</returns>
        public bool Update(ElingOA6_Admin_DSJCJ.Model.TaskDo model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        /// <param name="FTaskDoID">编号</param>
        /// <returns>是否删除成功</returns>
        public bool Delete(decimal FTaskDoID)
        {

            return dal.Delete(FTaskDoID);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        /// <param name="fTaskDoID">双主键处理编号</param>
        /// <param name="fTaskID">双主键主表编号</param>
        /// <returns>是否删除成功</returns>
        public bool Delete(decimal FTaskDoID, decimal FTaskID)
        {

            return dal.Delete(FTaskDoID, FTaskID);
        }

        /// <summary>
        /// 批量删除数据
        /// </summary>
        /// <param name="fTaskDoIDlist">编号列表</param>
        /// <returns>是否删除成功</returns>
        public bool DeleteList(string FTaskDoIDlist)
        {
            return dal.DeleteList(FTaskDoIDlist);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        /// <param name="FTaskDoID">编号</param>
        /// <returns>实体类</returns>
        public ElingOA6_Admin_DSJCJ.Model.TaskDo GetModel(decimal FTaskDoID)
        {

            return dal.GetModel(FTaskDoID);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <param name="strWhere">查询条件</param>
        /// <returns>DataSet对象</returns>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        /// <param name="Top">前几行数据</param>
        /// <param name="strWhere">查询条件</param>
        /// <param name="filedOrder">排序方式</param>
        /// <returns>DataSet对象</returns>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            return dal.GetList(Top, strWhere, filedOrder);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <param name="strWhere">查询条件</param>
        /// <returns>List对象</returns>
        public List<ElingOA6_Admin_DSJCJ.Model.TaskDo> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }

        /// <summary>
        /// DataTable转换为List
        /// </summary>
        /// <param name="dt">DataTable对象</param>
        /// <returns>List对象</returns>
        public List<ElingOA6_Admin_DSJCJ.Model.TaskDo> DataTableToList(DataTable dt)
        {
            List<ElingOA6_Admin_DSJCJ.Model.TaskDo> modelList = new List<ElingOA6_Admin_DSJCJ.Model.TaskDo>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                ElingOA6_Admin_DSJCJ.Model.TaskDo model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = dal.DataRowToModel(dt.Rows[n]);
                    if (model != null)
                    {
                        modelList.Add(model);
                    }
                }
            }
            return modelList;
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <param name="strWhere">查询条件</param>
        /// <returns>DataSet对象</returns>
        public DataSet GetAllList()
        {
            return GetList("");
        }

        /// <summary>
        ///  获取记录总数
        /// </summary>
        /// <param name="strWhere">查询条件</param>
        /// <returns>总记录数</returns>
        public int GetRecordCount(string strWhere)
        {
            return dal.GetRecordCount(strWhere);
        }
      

        #endregion  BasicMethod
        #region  ExtensionMethod

        #endregion  ExtensionMethod
    }
}

